<%@ page language="java" contentType="text/html; charset=BIG5"
	pageEncoding="BIG5"%>
<%@page import="hostsystem.Staffprofile"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<title>Insert title here</title>
</head>
<body>
	<%
		if (session.getAttribute("islogin") == null) {
			response.sendRedirect("login.html");
			return;
		}
	%>

	<script>
		function check(obj) {
			var o = document.getElementsByName(obj);
			var checkno=0;
			for (i = 0; i < o.length; i++)
				if (o[i].checked) {
					var checkno=checkno+1;				
				}
			if (checkno==0) {alert("please choose at least one staff!");}
			else {document.form1.submit();}
		}
	</script>

	<form method="post" name=form1 action="confirmbooking">
		<input type="hidden" value="<%=request.getParameter("date")%>"
			name="date"> <input type="hidden"
			value="<%=request.getParameter("time")%>" name="time">
		<jsp:useBean id="staffs" scope="session" type="java.util.List"></jsp:useBean>
		<%
			if (staffs.size() == 0) {
		%>
		No available staff! <BR> <input type="button" value="main"
			onClick="location='main.jsp'">
			<input type="button" value="choose date"
			onClick="location='createbooking1.jsp'">
		<%
			} else {
		%>
		<table border="2">
			<tr>
				<td></td>
				<td>Name</td>
				<td>Hourly Wage</td>
				<td>Description</td>
			</tr>
			<%
				//request.setAttribute("staffs1", staffs);
					for (int i = 0; i < staffs.size(); i++) {
						Staffprofile a = (Staffprofile) staffs.get(i);
			%>
			<tr>
				<td><input type="checkbox" name="staffcheck" value=<%=i + 1%>></td>
				<td><%=a.getName()%></td>
				<td><%=a.getWage()%></td>
				<td><%=a.getDescription()%></td>

			</tr>
			<%
				}
			%>

		</table>
		<input type="button" value="confirm" onclick=check("staffcheck")><input type="button" value="main" onClick="location='main.jsp'">
		<%
			}
		%>
		
	</form>
</body>
</html>